﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
using Imaginecup.recycling.Object.Entity;
using Imaginecup.recycling.Behavior;
using Imaginecup.Engine;

namespace Imaginecup.gameState.recycling.Sprite
{
    public class AnimationSprite : ISprite
    {
        private IAnimationBehavior m_Animation;
        private ObjectInfo m_SpriteInfo;
        public AnimationSprite(ObjectInfo info, IAnimationBehavior ani)
        {
            m_SpriteInfo = info;
            m_Animation = ani;
        }
        public void SetAnimationBehavior(IAnimationBehavior ani)
        {
            m_Animation = ani;
        }

        public void Draw(SpriteBatch spriteBatch, GameTime gameTime)
        {
            spriteBatch.Begin();

            spriteBatch.Draw(
                m_Animation.GetTexture(),
                Camera.WorldToScreen(Vector2.Subtract(m_SpriteInfo.WorldLocation, new Vector2(-10, 66))),
                m_Animation.FrameRectangle,
                Color.White
                );

            spriteBatch.End();
        }

        public ObjectInfo GetInfo()
        {
            return m_SpriteInfo;
        }
    }
}
